package com.Ajava1801D.线程池;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2020/10/6  15:54
 * 描述: 线程池 测试
 */
public class TestThredPool2 {

    public static void main(String[] args) throws InterruptedException {

        ArrayBlockingQueue<Runnable> arrayBlockingQueue = new ArrayBlockingQueue<>(2);

        LinkedBlockingQueue<Runnable> linkedBlockingQueue=new LinkedBlockingQueue<>();

        MyRejectedHander myRejectedHander = new MyRejectedHander(linkedBlockingQueue);

        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1,2,10,TimeUnit.SECONDS,arrayBlockingQueue,myRejectedHander);

        for(int i=0;i<10;i++){

            threadPoolExecutor.execute(new ThreadPoolRunable2());

        }


    }

}
